<?php defined('SYSPATH') OR die('No direct access allowed.');

// Dies ist der Basis-Controller er Applikation. 
class Login_Controller extends Base_Controller{
	   
	public function __construct()
	
	{ 	  
		parent::__construct();	
	} 
	
	public function index(){
		$this-> template->navileft='';	
		$content=new View('login');
		$this->template->content=$content;		
		if(isset($_POST['login'])){
			$this->auth->login($this->input->post('username'),$this->input->post('password'));	
			if($this->auth->logged_in()!=FALSE){
				url::redirect('view/home');
			}else{
				$content->errors='Username or Password not correct';
			}		
		}
	}
	
	public function logout(){
		$this->auth->logout();
		$this->session->destroy();
		url::redirect('login');
	}
}
